package homework;

import java.io.*;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入姓名");
        String name = scan.nextLine();
        System.out.println("请输入密码");
        String pwd = scan.nextLine();
        System.out.println("请输入小名");
        String nick = scan.nextLine();
        System.out.println("请输入年龄");
        int age = scan.nextInt();
        User user = new User(name,pwd,nick,age);
        try (
             ObjectOutputStream ois = new ObjectOutputStream(
                     new FileOutputStream(user.getName()+".obj"));
             ) {
            ois.writeObject(user);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
